<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<script type="text/javascript">
        
        	var selected="ID";
        
       		function change(src)
        	{
       			selected = src.options[src.selectedIndex].value;
       		}
        
            function validation(obj) 
            {
            	var return_value = true;
            	var idname ="query";
            	var str;
            	
            	var idReg = new Array(/^\d+$/,
            						  /^[A-Za-z0-9]+$/);
         		
				if (selected == "ID" )
				{
               		str=document.getElementById(idname).value;
              	  	if(RegExp(idReg[0]).exec(str) == null) 
              	  	{
                    	return_value = false;
              	  	}
              	}
				else
				{
	          		str=document.getElementById(idname).value;
              	  	if(RegExp(idReg[1]).exec(str) == null) 
              	  	{
                    	return_value = false;
              	  	}
				}
				
                return return_value;
            }
            
        </script>

<div class="user">Поиск пользователей</div>
<br/>
<form:form method="POST" commandName="findquery"  onsubmit="return  validation(this)" action="#">
	<table cellpadding="0" class="list_user" border="1" bordercolor="#000000" width="100%" cellspacing="0">
		<tr>
			<td width="140" class="list_user_head">
				<form:select class="inputbox" path="type" OnChange="change(this)" name="type">
					<form:option value="ID" label="By id" />
					<form:option value="login" label="By login" />
				</form:select>
			</td>
			<td width="230" class="list_user">
				<form:input class="inputbox" path="query" name="query" />
			</td>
		</tr>
	</table>
<br/>
<input type="submit" value=" Найти ">
</form:form>
<br/>

<jsp:include page="/WEB-INF/jsp/Admin/userlist.jsp" />




